Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
👋 Codeowner Review RequestThe following codeowners have been identified for the changed files: Team reviewers: @nodejs/nodejs-website Please review the changes when you have a chance. Thank you! 🙏 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8516 +/- ##
==========================================
+ Coverage 74.22% 74.70% +0.48%
==========================================
Files 106 102 -4
Lines 9102 8956 -146
Branches 308 305 -3
==========================================
- Hits 6756 6691 -65
+ Misses 2344 2263 -81
Partials 2 2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Pull request overview
This PR simplifies the codebase by consolidating hook functionality and reorganizing the hooks directory structure. The main change moves copy-to-clipboard functionality from useCopyToClipboard to a new useCopy hook in the @node-core/ui-components package, allowing BaseCodeBox to handle copying internally.
- Consolidates
useCopyToClipboardinto a newuseCopyhook in ui-components package - Reorganizes hooks directory from
react-client/react-server/react-generictoclient/server/generic - Moves array utility functions from shared location to Select-specific utils file
Reviewed changes
Copilot reviewed 36 out of 41 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
packages/ui-components/src/hooks/useCopy.ts |
New hook consolidating copy-to-clipboard functionality |
packages/ui-components/src/hooks/__test__/useCopy.test.jsx |
Test file updated to use new useCopy hook with import path changes |
packages/ui-components/src/Common/BaseCodeBox/index.tsx |
Now uses useCopy internally, accepts label props instead of callback/content props |
packages/ui-components/src/Common/Select/utils.ts |
Array utility functions moved here from shared util/array.ts |
packages/ui-components/src/Common/Select/index.tsx |
Updated to use mapValues from local utils file |
packages/ui-components/src/Common/Select/StatelessSelect/index.tsx |
Updated to use mapValues from parent utils file |
packages/ui-components/package.json |
Version bumped from 1.5.0 to 1.5.1 |
apps/site/hooks/client/* |
Hooks reorganized from react-client to client directory |
apps/site/hooks/server/* |
New server hooks directory with useClientContext |
apps/site/hooks/generic/* |
New generic hooks directory with useSiteNavigation |
apps/site/components/Common/CodeBox.tsx |
Simplified to use BaseCodeBox's internal copy handling |
| Various component files | Import paths updated to reflect new hooks directory structure |
Comments suppressed due to low confidence (2)
packages/ui-components/src/hooks/test/useCopy.test.jsx:9
- The test is missing a mock setup for navigator.clipboard.writeText. The code at line 9 assigns a function that returns a Promise, but the test expects a mock object with mock.callCount() and mock.calls. The test should use t.mock.method to properly set up the mock, similar to what was removed in the diff.
packages/ui-components/src/hooks/test/useCopy.test.jsx:11 - The test description says 'useCopyToClipboard' but the hook has been renamed to 'useCopy'. The test description should be updated to match the new hook name.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📦 Build Size ComparisonSummary
Changes➕ Added Assets (14)
➖ Removed Assets (14)
|
This PR simplfiies our usage of
useXYZhooks. In the process, it movesuseCopyToClipboardto a similaruseCopyhook in@node-core/ui-components, so thatCodeBoxperforms it's copy logic internally. (This allows for less code to duplicate indoc-kit)